LC_EVENT_ENTPROP Home

LiteCAD generates LC_EVENT_ENTPROP event when a property of graphic entity has been changed.

The following properties are used for this event type:

Property Description
LC_PROP_EVENT_TYPE Value LC_EVENT_ENTPROP
LC_PROP_EVENT_ENTITY Handle to an entity
LC_PROP_EVENT_BLOCK Handle to a block which contains the entity
LC_PROP_EVENT_DRW Handle to a drawing
LC_PROP_EVENT_INT1 Entity's property identifier (LC_PROP_...)
LC_PROP_EVENT_INT2 Vertex index (optional)
LC_PROP_EVENT_INT3 Previous value (if type is bool, int)
LC_PROP_EVENT_INT4 Current value
LC_PROP_EVENT_FLOAT1 Previous value (if type is float)
LC_PROP_EVENT_FLOAT2 Current value
LC_PROP_EVENT_STR1 Previous value (if type is string)
LC_PROP_EVENT_STR2 Current value


Properties of "HANDLE" type use object identifier, for example, we have to catch a moment when text style of text entity was changed:
//-----------------------------------------------
void OnEntProp (HANDLE hEvent)
{
  HANDLE hDrw, hEnt, hStyle;
  int idProp, ival;
  WCHAR szBuf[256];

  hDrw = lcPropGetHandle( hEvent, LC_PROP_EVENT_DRW );
  hEnt = lcPropGetHandle( hEvent, LC_PROP_EVENT_ENTITY );
  idProp = lcPropGetInt( hEvent, LC_PROP_EVENT_INT1 );
  switch( idProp ){
    case LC_PROP_TEXT_STYLE:
      // text style of entity hEnt was changed	
      ival = lcPropGetInt( hEvent, LC_PROP_EVENT_INT3 );  // previous text style ID
      ival = lcPropGetInt( hEvent, LC_PROP_EVENT_INT4 );  // current text style ID
      // get text style handle by its ID
      hStyle = lcDrwGetObjectByID( hDrw, LC_OBJ_TEXTSTYLE, ival );
      if (hStyle){
        // get name of current text style
        wcsncpy( szBuf, lcPropGetStr( hStyle, LC_PROP_TSTYLE_NAME ), 250 );
      }
      break;
...	  
  }
}

//-----------------------------------------------
void CALLBACK EventProc (HANDLE hEvent)
{
  int EventType;
  EventType = lcPropGetInt( hEvent, LC_PROP_EVENT_TYPE );
  switch( EventType ){
    case LC_EVENT_ENTPROP: OnEntProp( hEvent ); break;
    ...
  }
}